<?php

namespace App\Http\Requests\ExchangeController;

use Illuminate\Foundation\Http\FormRequest;

class SyncHashRequest extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        $rules = [
            'eth_number' => ['required', 'numeric', 'min:0.0001'],
            'hash'       => ['required',  'unique:exchanges,hash']
        ];

        return $rules;
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'eth_number.required' => __('ETH数量必填'),
            'eth_number.numeric'  => __('ETH数量必须数字'),
            'eth_number.min'      => __('ETH数量最小0.0001'),
            'hash.required'       => __('交易Hash必填'),
            'hash.unique'         => __('交易Hash已存在'),
        ];
    }
}
